﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.ComponentModel;
using CapaPresentacion.ValidationRules;

namespace CapaPresentacion.Controles
{
    /// <summary>
    /// Lógica de interacción para LabelAndTextBox.xaml
    /// </summary>
    public partial class LabelAndTextBox : UserControl
    {
        public static readonly DependencyProperty TextoProperty = DependencyProperty.Register("Texto", typeof(string), typeof(LabelAndTextBox));

       
        public LabelAndTextBox()
        {
            InitializeComponent();
            
            Binding b = new Binding();
            b.Source = this;
            b.Path = new PropertyPath(LabelAndTextBox.TextoProperty);
            b.Mode = BindingMode.TwoWay;           
            

            this.txt.SetBinding(TextBox.TextProperty, b);
        }

        public int Longitud
        {
            set { txt.MaxLength = value; }
        }

        public string Etiqueta
        {
            get { return lbl.Content.ToString(); }

            set { lbl.Content = value; }
        }

        public FontFamily TipoLetra
        {     
            set { lbl.FontFamily = txt.FontFamily =  value; }
        }


        public string Texto
        {
            get { return (string)GetValue(TextoProperty); }
            set { SetValue(TextoProperty, value); }
        }

       
    }
}
